//endSignUp.js
const app = getApp()
var i = 0
Page({
  data: {
    endSignUpData:null,
  },

  onLoad: function () {
    var that = this

    /**
     * 时间格式化
     */
    function transDate(mescStr) {
      var n = mescStr;
      var date = new Date(n);
      var Y = date.getFullYear() + '-';
      var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
      var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
      return (Y + M + D)
    }
    /**
        * 请求已结束任务数据
        */
    wx.request({
      url: app.globalData.API_URL + "signUp/getEndSignUp",
      data: {
        token: app.globalData.token,
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      method: 'post',
      success: function (r) {
        if (r.data.code == 0) {
          console.log(r.data.data)
          for(var i =0; i<r.data.data.length; i++){
            that.setData({
              endTime: transDate(r.data.data[i].endTime),
            })   
          }
          that.setData({
            endSignUpData:r.data.data,
          })
        }
      }
    })
  },
})